Create a shortname when we don't have one.
authorrobertl <robertl@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Mon, 10 Feb 2003 19:20:06 +0000 (19:20 +0000)
committerrobertl <robertl@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Mon, 10 Feb 2003 19:20:06 +0000 (19:20 +0000)
gpsbabel/waypt.c

index 49704b4d5060c0d8607bca9801a1da28b7052d58..7b916040b5f6a48fd03c79b07b678901847ee174 100644 (file)
@@ -37,6 +37,21 @@ void
 waypt_add(waypoint *wpt)
 {
        ENQUEUE_TAIL(&waypt_head, &wpt->Q);
+
+       /*
+        * Some input may not have one or more of these types so we
+        * try to be sure that we have these fields even if just by
+        * copying them from elsewhere.
+        */
+       if (wpt->shortname == NULL) {
+               if (wpt->description) {
+                       wpt->shortname = xstrdup(wpt->description);
+               } else {
+                       if (wpt->notes) {
+                               wpt->shortname = xstrdup(wpt->notes);
+                       }
+               }
+       }
        if (wpt->description == NULL) {
                if (wpt->notes != NULL) {
                        wpt->description = xstrdup(wpt->notes);